//
//  ChatEventCardView.swift
//  Hyphenate-Demo-Swift
//
//  Created by curtainup on 2018-12-10.
//  Copyright © 2018 curtainups. All rights reserved.
//


import UIKit
import Hyphenate


@objc protocol EMEventBubbleViewDelegate {
    @objc optional
    func didBubbleViewPressed(model: EMMessageModel)
}

class ChatEventCardView: EMChatTextBubbleView {

    @objc override func bubbleViewPressed(sender: UITapGestureRecognizer) {
        if delegate != nil {
//            let storyboard = UIStoryboard.init(name: "EventDetailVC", bundle: nil)
//            let vc = storyboard.instantiateInitialViewController() as! EventDetailVC
//            vc.eid = eid
//            self.parentContainerViewController()?.navigationController?.pushViewController(vc, animated: true)
        }
    }
    
    var eid = "";
    
    let BUBBLE_VIEW_MORE_SPACE_FOR_WORDS: CGFloat = 0
    override func set(model: EMMessageModel) {
        super.set(model: model)
        _model = model
        
        if let message = model.message,
            let ext = message.ext,
            let eventId = ext["eventId"]{
            eid = String(describing: eventId);
            textLabel.backgroundColor = WhiteColor
        }
        else
        {
            textLabel.backgroundColor = UIColor.clear
        }
        textLabel.textAlignment = NSTextAlignment.center;
        
//        textLabel.backgroundColor = WhiteColor
        
        textLabel.textColor = AlmostBlackColor
        
               _backImageView?.backgroundColor = _model!.message!.direction == EMMessageDirectionSend ? KermitGreenColor : CoolGrayColor
        
    }
    
 
    
}
